import hyRequest from '../index'
import { IAccount, accountLogin, IDataType } from './type'

enum LoginAPI {
  AccountLogin = '/login',
  UserInfo = '/users/',
  MenuInfo = '/role/'
}

/**
 * @description 用户登录接口
 * @param account
 * @returns
 */
export function accountLoginRequest(account: IAccount) {
  return hyRequest.post<IDataType<accountLogin>>({
    url: LoginAPI.AccountLogin,
    data: account
  })
}

/**
 * @description 查询某个用户
 */
export function getUserInfo(id: number) {
  return hyRequest.get<IDataType>({
    url: LoginAPI.UserInfo + id,
    showLoading: false
  })
}

/**
 * @description 获取用户导航信息
 */

export function getMenuInfo(id: number) {
  return hyRequest.get<IDataType>({
    url: LoginAPI.MenuInfo + id + '/menu',
    showLoading: false
  })
}
